/*
** lib_1.c for  in /u/all/caille_c/cu/rendu/c/minishell1
** 
** Made by carole cailleux
** Login   <caille_c@epitech.net>
** 
** Started on  Sun Jan  3 16:02:56 2010 carole cailleux
** Last update Wed Feb 24 14:55:28 2010 carole cailleux
*/

#include <stdlib.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#include "serv.h"

void		my_putchar(char c)
{
  write(1, &c, 1);
}

void		my_put_nbr(int nb)
{
  if (nb < 0)
    {
      nb = nb * (-1);
      my_putchar('-');
    }
  if (nb / 10 > 0)
    my_put_nbr(nb / 10);
  my_putchar((nb % 10) + '0');
}

void		my_putstr(char *str)
{
  int		i;

  i = 0;
  if (str != 0)
    {
      while (str[i] != 0)
        {
          my_putchar(str[i]);
          i = i + 1;
        }
    }
}

int		my_strlen(char *str)
{
  int		i;

  i = 0;
  if (str == NULL)
    return (0);
  while (str[i])
    i++;
  return (i);
}

int		power(int nb, int power)
{
  int		i;
  int		res;

  i = 1;
  res = nb;
  if (power == 0)
    return (1);
  while (i < power)
    {
      res = res * nb;
      i++;
    }
  return (res);
}
